<?php
//------------------------
// 前台订单验证器
//-------------------------

namespace app\common\validate;

use think\Validate;


class Order extends Validate
{
    protected $rule = [
        // 买家在前台购物车确认订单时验证
		'address_id'             => 'require|number',
		'user_remark|买家留言'   => 'max:150',
        'invoice_title|发票抬头' => 'max:150',
        // 管理员后台微调价格时验证
		'fine_tune_price|微调价格' => 'max:16|float',
        // 发货信息填写时验证
        'deliver_sn|发货单号' =>'require|max:64',
        'shipping_id' =>'require',
    ];

    protected $message = [
        'address_id.require'         => '请选择地址信息',
        'user_remark.max'            => '买家留言请不要超过50个汉字',
        'invoice_title.max'          => '发票抬头请不要超过50个汉字',
        'shipping_id.require'          => '请选择物流公司',
    ];

    protected $scene = [
        'add'  => ['address_id', 'user_remark','invoice_title'],
        'trimPrice'  => ['fine_tune_price'],
        'deliverGoods'  => ['deliver_sn','shipping_id'],
    ];


}